import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:getwidget/components/border/gf_border.dart';
import 'package:getwidget/types/gf_border_type.dart';

import '../controllers/gfborder_controller.dart';

class GfborderView extends GetView<GfborderController> {
  String avatarPath = 'assets/images/dh5.jpg';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('边框'),
        centerTitle: true,
      ),
      body: Container(
        margin: EdgeInsets.all(10),
        child: ListView(
          children: [
            Container(
              margin: EdgeInsets.symmetric(
                horizontal: 15, 
                vertical: 15
              ),
              child: GFBorder(
                color: Color(0xFF19CA4B),
                dashedLine: [2, 0],
                type: GFBorderType.rect,
                strokeWidth: 2,
                child: Image.asset(
                  avatarPath,
                  width: MediaQuery.of(context).size.width,
                  fit: BoxFit.fitWidth,
                ),
              ),
            ),
            Divider(),

            Container(
              margin: EdgeInsets.symmetric(
                horizontal: 15, 
                vertical: 15
              ),
              child: GFBorder(
                dashedLine: [14, 16],
                type: GFBorderType.rect,
                color: Color(0xFF19CA4B),
                strokeWidth: 4,
                child: Image.asset(
                  avatarPath,
                  width: MediaQuery.of(context).size.width,
                  fit: BoxFit.fitWidth,
                ),
              ),
            ),
            Divider(),

            Container(
              margin: EdgeInsets.symmetric(
                horizontal: 15, 
                vertical: 15
              ),
              child: GFBorder(
                color: Color(0xFF19CA4B),
                dashedLine: [5, 5],
                type: GFBorderType.rect,
                strokeWidth: 4,
                child: Image.asset(
                  avatarPath,
                  width: MediaQuery.of(context).size.width,
                  fit: BoxFit.fitWidth,
                ),
              ),
            ),
            Divider(),

            Container(
              margin: EdgeInsets.symmetric(
                horizontal: 15, 
                vertical: 15
              ),
              child: GFBorder(
                color: Color(0xFF19CA4B),
                dashedLine: [2, 0],
                type: GFBorderType.rect,
                child: Container(
                  height: 100,
                  color: Color(0xFFE9FFEF),
                ),
              ),
            ),
            Divider(),

            Container(
              margin: EdgeInsets.symmetric(
                horizontal: 15, 
                vertical: 15
              ),
              child: GFBorder(
                radius: Radius.circular(20),
                color: Color(0xFF19CA4B),
                dashedLine: [2, 0],
                type: GFBorderType.rRect,
                child: Container(
                  height: 100,
                  color: Color(0xFFE9FFEF),
                ),
              ),
            ),
            Divider(),

            Container(
              width: 50,
              height: 60,
              child: GFBorder(
                type: GFBorderType.oval,
                dashedLine: [2, 0],
                color: Color(0xFF19CA4B),
                strokeWidth: 2,
                child: Center(child: Text('Oval Border')),
              ),
            ),
            Divider(),

            Container(
              width: 100,
              height: 100,
              child: GFBorder(
                type: GFBorderType.circle,
                dashedLine: [4, 6],
                color: Color(0xFF19CA4B),
                strokeWidth: 2,
                child: Center(
                  child: Text(
                    'Circular Border',
                    textAlign: TextAlign.center,
                  )
                ),
              ),
            ),

          ],
        ),
      ),
    );
  }
}
